#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:exercise1.py
# author:wmf
# datetime:2021/4/14 21:08
# software: PyCharm
'''
this is function description
'''


# import module your need


# 利用闭包返回一个计数器函数，每次调用它返回递增整数：


def createCounter():
    s = [0]

    def counter():
        s[0] += 1
        return s[0]

    return counter


counterA = createCounter()
print(counterA(), counterA(), counterA(), counterA(), counterA()) # 1 2 3 4 5
counterB = createCounter()
if [counterB(), counterB(), counterB(), counterB()] == [1, 2, 3, 4]:
    print('测试通过!')
else:
    print('测试失败!')